package Views;

import UCM.UCDisplayCreateUser;
import java.awt.*;
import javax.swing.JButton;
import javax.swing.JPanel;

/**
 * Creats the view to display the user
 * @author Josh
 */
public class ViewDisplayCreateUser extends JPanel {

    private JButton registerButton = new JButton("Register");
    private final UCDisplayCreateUser UCDisplayCreateUser = new UCDisplayCreateUser(this);
    private MainUI view;

    /**
     * Construction that initualises the view
     * @param view
     */
    public ViewDisplayCreateUser(MainUI view) {
        this.view = view;
        this.setLayout(new FlowLayout());
        this.add(registerButton);
        registerButton.addActionListener(new AdapterUCCToAL(UCDisplayCreateUser));
        this.setVisible(true);
    }

    /**
     * Sets the create user panel visible
     */
    public void setCreateUserVisible() {
        view.removeCenterPanel();
        view.add(view.getCreateUserPanel(), BorderLayout.CENTER);
        view.pack();
    }
}
